package com.yq.order.http;

import okhttp3.ResponseBody;
import retrofit2.Call;
import retrofit2.http.*;

import java.util.Map;

/**
 * Created by yinqi on 2018/9/1.
 */
public interface HttpService {

    @Headers({"User-Agent:Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36"
            , "Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8"
            , "Accept-Language:zh-CN,zh;q=0.8"
            , "Cache-Control:max-age=0"
            ,"X-Forwarded-For: 1.1.1.1"
//            , "Cookie:JSESSIONID=MhCUHJeIBSjM43-sCuguogb2KYxlE5fs39ruIKjSqPFHsS192MhR!1003117834; Hm_lvt_da6f1445af3167cf70ef00845d0e716b=1535726788,1535768409,1535788220"
//            , "If-Modified-Since:Tue, 28 Aug 2018 15:49:00 GMT"
            , "Referer:http://www.ems.com.cn/ems/order/singleQuery_t"
            , "Upgrade-Insecure-Requests:1"})
    @GET("mailtracking/you_jian_cha_xun.html")
    Call<String> getHtml(@Header("Cookie") String lpvt);

    @Headers({"User-Agent:Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36"
            , "Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8"
            , "Accept-Language:zh-CN,zh;q=0.8"
            , "Cache-Control:max-age=0"
            ,"X-Forwarded-For: 1.1.1.1"
//            , "Cookie:JSESSIONID=MhCUHJeIBSjM43-sCuguogb2KYxlE5fs39ruIKjSqPFHsS192MhR!1003117834; Hm_lvt_da6f1445af3167cf70ef00845d0e716b=1535726788,1535768409,1535788220"
//            , "If-Modified-Since:Tue, 28 Aug 2018 15:49:00 GMT"
            , "Referer:http://www.ems.com.cn/ems/order/singleQuery_t"
            , "Upgrade-Insecure-Requests:1"})
    @Streaming
    @GET("ems/rand")
    Call<ResponseBody> downloadCodePic(@Header("Cookie") String cookie);

    @Headers({"User-Agent:Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36"
            , "Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8"
            , "Accept-Language:zh-CN,zh;q=0.8"
            , "Cache-Control:max-age=0"
            ,"X-Forwarded-For: 1.1.1.1"
//            , "Cookie:JSESSIONID=MhCUHJeIBSjM43-sCuguogb2KYxlE5fs39ruIKjSqPFHsS192MhR!1003117834; Hm_lvt_da6f1445af3167cf70ef00845d0e716b=1535726788,1535768409,1535788220"
//            , "If-Modified-Since:Tue, 28 Aug 2018 15:49:00 GMT"
            , "Referer:http://www.ems.com.cn/ems/order/singleQuery_t"
            , "Upgrade-Insecure-Requests:1"})
    @POST("ems/order/singleQuery_t")
    @FormUrlEncoded
    Call<String> queryOrder(@Header("Cookie") String cookie, @FieldMap Map<String, String> paramsMap);

}
